Những câu hỏi liên quan
APOK FF
Xem chi tiết
PGD FF
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 1 2021 lúc 9:25

const fi='timmax.inp'     

fo='timmax.out'

var f1,f2:text;   

st,xauso:ansistring;   

d,i,max,x:longint;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,st);

d:=length(st);

xauso:=''

max:=0;

for i:=1 to d do 

if st[i] in ['0'..'9'] then xauso:=xauso+st[i] 

else begin         

              val(xauso,x);         

              if max<=x then max:=x;         

              xauso:=''       

        end;

if max=0 then writeln(f2,'-1')

else writeln(f2,max);

close(f1);

close(f2);

end.

Bình luận (0)
le hong trinh
Xem chi tiết
NGUYỄN THỊ MỸ LINH
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 1 2022 lúc 21:40

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i;

int main()

{

freopen("so.inp","r",stdin);

freopen("so.out","w",stdout);

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++)

if (a[i]%2==0) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)
Mộng Chúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 10:03

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,j;

bool kt;

int main()

{

freopen("nguyento.inp","r",stdin);

freopen("nguyento.out","w",stdout);

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++)

if (a[i]>1) 

{

kt=true;

for (j=2; j*j<=a[i]; j++)

if (a[i]%j==0) kt=false;

if (kt==true) cout<<a[i]<<" ";

}

return 0;

}

Bình luận (0)
Chuu
Xem chi tiết
huynh chinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2022 lúc 21:49

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i;

int main()

{

freopen("dayd.inp","r",stdin);

freopen("dayd.out","w",stdout);

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++)

if (a[i]>0) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)
Tuong Le
Xem chi tiết
Nguyễn Lê Phước Thịnh
16 tháng 12 2020 lúc 22:41

const fo='int.txt'

fo='out.txt'

var f1,f2:text;

m,n:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,m);

readln(f1,n);

writeln(f2,m+n);

close(f1);

close(f2);

end.

Bình luận (0)
Nguyễn Đức Anh Khoa
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 1 2021 lúc 12:30

const fi='tong.inp'

fo='tong.out'

var f1,f2:text;

a:array[1..100]of integer;

n,i,t:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t);

close(f1);

close(f2);

end.

Bình luận (0)